<style>
#collection,#no_collection{
position: absolute;
width: 20px;
height: 20px;
right: 12%;
bottom: 36px;

}
</style>
    <div id="main">
            <div class="content">
                <div class="container">
                    <div class="row">
                        <div class="posts-block col-lg-9 col-md-9 col-sm-8 col-xs-12">
                            <div id="options">
                                <ul class="clearfix">
                                    <li><a href="{:url('scenery/index')}">全部景区</a></li>

                                    {volist name="category_list" id="vo" key="k"}
                                        {notempty  name="$cate_id"}
                                            <li><a href="{:url('scenery/index?cate_id='.$vo['id'])}" {if condition="$vo['id'] eq $cate_id"}class="selected"{/if}>{$vo.name}</a></li>
                                            {else /}
                                            <li><a href="{:url('scenery/index?cate_id='.$vo['id'])}" {if condition="$k eq 0"}class="selected"{/if}>{$vo.name}</a>
                                        {/notempty}
                                    {/volist}
                                </ul>
                            </div>
                        </div>
                        <div class="sidebar col-lg-3 col-md-3 col-sm-4 col-xs-12">
                            <!-- Search Widget Start -->
                           <!-- <div class="widget search-form">
                                <form class="input-group" action="/XJTA_Web/e/search/index.php" method="post" name="searchform">
                                    <input type="hidden" name="tempid" value="2" />
                                    &lt;!&ndash;搜索模版ID&ndash;&gt;
                                    <input type="hidden" name="classid" value="11">
                                    &lt;!&ndash;搜索栏目ID&ndash;&gt;
                                    <input type="hidden" name="show" value="title,newstext,ftitle,pro,city,area,subtyp,serv,lbl" />
                                    <input name="keyboard" type="text" value="搜索景区名、级别等关键字..."
                                           onfocus="
          if (this.value === '搜索景区名、级别等关键字...')
            this.value = '';" onblur="
                            if (this.value == '')
               this.value = '搜索景区名、级别等关键字...';"
                                           class="search-input form-control">
                                    <span class="input-group-btn">
    <button type="submit" class="subscribe-btn btn"><i class="icon-search"></i></button>
    </span>
                                </form>
                            </div>-->

                            <!-- Search Widget End -->
                        </div>
                    </div>
                    <div class="title-divider"></div>
                    <div class="row">
                        <div class="portfolio three-column">
                            {volist name="list" id="vo"}
                            <div class="col-lg-4 col-md-4 col-sm-4 col-xs-12 item">

                                  <div class="portfolio-item">
                                    <a href="/scenery/details?id={$vo.id}">
                                        <span class="portfolio-item-hover"></span>
                                        <span class="fullscreen"><i class="icon-search"></i></span><img src="{$vo.cover_id|get_picture_url}" alt="喀拉峻-世界自然遗产" title = "查看详情"/>
                                    </a>
                                    <div class="portfolio-item-title">
                                        <a href="/XJTA_Web/ZH_CN/Tourism_Resource/Tourism_Scenery/13.html">{$vo.name}</a>
                                        <p>
                                            景区级别：{$vo.category_name}级 &nbsp;&nbsp;&nbsp;&nbsp;<a href="javascript:void(0)" data="{$vo['id']}" onclick="setCollection(this)" style="font-size: 12px; color: #FF0000" title = "">
                                              {if condition="is_collection($vo['id'],4)"}
                                                     <img id="collection" class="collection" src="__STATIC__/module/index/img/collenction.png" alt="">
                                                    {else /}
                                                    <img id="no_collection" class="no_collection" src="__STATIC__/module/index/img/no_collenction.png" alt="">
                                              {/if}

                                            </a>
                                        </p>
                                    </div>
                                    <div class="clearfix"></div>
                                </div>

                            </div>
                            {/volist}
                        </div>
                    </div>
                </div>
            </div>
        </div>

<script>
  /*  window.onbeforeunload = function () {
        var scrollPos;
        if (typeof window.pageYOffset != 'undefined') {
            scrollPos = window.pageYOffset;
        }
        else if (typeof document.compatMode != 'undefined' && document.compatMode != 'BackCompat') {
            scrollPos = document.documentElement.scrollTop;
        }
        else if (typeof document.body != 'undefined') {
            scrollPos = document.body.scrollTop;
        }
        document.cookie = "scrollTop=" + scrollPos; //存储滚动条位置到cookies中
    }*/

    function setCollection(e){
        var id = $(e).attr('data');
        var img = $(e).children;
        console.log(img)
        var url = "{:url('/api.php/collection/setSceneryCollection')}";
        $.post(url,{id:id},function(e){
            if (e.code==2){
                alert(e.msg);
                location.href = '/login/index';
            }else{
                alert(e.msg);
                window.location.reload();
            }
        })
    }/*
    window.onload=function(){
        if (location.href.indexOf("?xjta=")<0)
        {
            //location.href=location.href+"?xjta="+Math.random();
        }
        if (document.cookie.match(/scrollTop=([^;]+)(;|$)/) != null) {
            var arr = document.cookie.match(/scrollTop=([^;]+)(;|$)/); //cookies中不为空，则读取滚动条位置
            document.documentElement.scrollTop = parseInt(arr[1]);
            document.body.scrollTop = parseInt(arr[1]);
        }
    }*/
</script>
<script>
    lightGallery(document.getElementById('lightgallery'));
</script>